package com.book.Dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class SelectAllOrder {
       public ResultSet findorder(){
    	   Connection conn=null;
    	   Statement stm=null;
    	   ResultSet rs=null;
    	   String sql="select * from orders order by orderid";
    	   try {
			Class.forName("oracle.jdbc.driver.OracleDriver");
			conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL","scott","tiger");
			stm=conn.createStatement();
			rs=stm.executeQuery(sql);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return rs;
       }
       public ResultSet finwfahuo(int status){
    	   Connection conn=null;
    	   Statement stm=null;
    	   ResultSet rs=null;
    	   String sql="select * from orders where STATUS="+status+" order by orderid";
    	   try {
			Class.forName("oracle.jdbc.driver.OracleDriver");
			conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL","scott","tiger");
			stm=conn.createStatement();
			rs=stm.executeQuery(sql);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return rs;
       }
       public ResultSet finwfahuo(int status,String e_user_id){
    	   Connection conn=null;
    	   Statement stm=null;
    	   ResultSet rs=null;
    	   String sql="select * from orders where STATUS="+status+" and e_user_id='"+e_user_id+"' order by orderid";
    	   try {
			Class.forName("oracle.jdbc.driver.OracleDriver");
			conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL","scott","tiger");
			stm=conn.createStatement();
			rs=stm.executeQuery(sql);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return rs;
       }
       public ResultSet finyifahuo(int status){
    	   Connection conn=null;
    	   Statement stm=null;
    	   ResultSet rs=null;
    	   String sql="select * from orders where STATUS="+status+" order by orderid";
    	   try {
			Class.forName("oracle.jdbc.driver.OracleDriver");
			conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL","scott","tiger");
			stm=conn.createStatement();
			rs=stm.executeQuery(sql);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return rs;
       }
       
       public ResultSet finyifahuo(int status,String e_user_id){
    	   Connection conn=null;
    	   Statement stm=null;
    	   ResultSet rs=null;
    	   String sql="select * from orders where STATUS="+status+" and e_user_id='"+e_user_id+"' order by orderid";
    	   try {
			Class.forName("oracle.jdbc.driver.OracleDriver");
			conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL","scott","tiger");
			stm=conn.createStatement();
			rs=stm.executeQuery(sql);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return rs;
       }
}
